Willamette Falls, 2018. Credit: Oregon Metro Council ## Overview {.tabset .tabset-pills}

The following report examines….A brief summary (3 - 4 sentences) of the dataset, and what is included in this report

A map of the fish ladder location (you can make this in R on your own, or include an existing map appropriately licensed, with attribution)

A professionally formatted data citation

knitr::opts_chunk$set(echo = TRUE)
# attach packages
library(tidyverse)
library(here)
library(lubridate)
library(tsibble)
library(feasts)
library(slider)
library(janitor)
library(patchwork)
library(gghighlight)
library(plotly)

Reading in the data

# reading in and preparing the data
fish <- read_csv(here("data", "willamette_fish_passage.csv")) %>% 
  clean_names() %>%
  mutate(date = lubridate::mdy(date)) %>% # turning the date into mdy format with lubridate 
  as_tsibble(key = NULL, index = date) %>% # changing the format to a tsibble for use in time series
  select(date, coho, jack_coho, steelhead) # selecting for fish species of interest
## Rows: 3652 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Project, Date
## dbl (6): Chinook, Jack Chinook, Steelhead, Coho, Jack Coho, TempC
## lgl (8): Chinook Run, Wild Steelhead, Sockeye, Shad, Lamprey, Bull Trout, Ch...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# changing all NA values to 0 
fish[is.na(fish)] <- 0 

# creating a longer df with single observations for each of the fish species of interest
fish_longer <- fish %>% 
  pivot_longer(cols = 2:4, names_to = "species", values_to = "count") %>% # selecting for fish species of interest
  mutate(species = case_when(
    species == "coho" ~ "Coho",
    species == "jack_coho" ~ "Jack Coho", 
    species == "steelhead" ~ "Steelhead"))


# changing all NA values to 0 
fish[is.na(fish)] <- 0 

Tab 1: Original time series

ggplot(data = fish_longer, aes(x = date, 
                               y = count, 
                               color = species)) +
  geom_line (size = 0.4) +
  theme_minimal() +
  theme(legend.position = c(.5, .8),
        legend.title = element_blank(),
        legend.text = element_text(
          size = 12
        )) +
  scale_color_manual(values = c("firebrick3", "goldenrod", "darkgreen")) 

We need to ask some big picture questions at this point, like:

Tab 2: Seasonplots

# season plot for each fish species
fish_longer %>% 
  gg_season(y = count) +
  facet_wrap( ~ species)

Add 2 - 3 bullet points summarizing the major trends you see in the seasonplots.

Tab 3: Annual counts by species

fish_annual <- fish_longer %>% 
  index_by(year = ~year(.)) %>% 
  group_by(species) %>% 
  summarize(yearly_counts = sum(count))

ggplot(data = fish_annual, aes(x = year, y = yearly_counts, color = species)) +
         geom_line()